package fmfi.chatbox;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class SendActivity extends Activity
{
	private Messenger messender = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.send_layout);
		
		Intent intent = getIntent();
		messender = new Messenger(this, intent.getStringExtra("key"), intent.getStringExtra("fbUserID"), intent.getStringExtra("fbToken"));
	}
	
	public void buttonSendMessage(View sender)
	{
		TextView t = (TextView) findViewById(R.id.edit_view_id);

		if (messender.sendMessage(t.getText().toString()) == true)
			setResult(RESULT_OK);
		else
			setResult(RESULT_CANCELED);
		finish();
	}
	
	public void onBackPressed()
	{
		setResult(RESULT_CANCELED);
		finish();
	}
	
	public void buttonCancelMessage(View sender)
	{
		setResult(RESULT_CANCELED);
		finish();
	}
	
}
